<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
<!--react核心库-->
<script src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/react/18.2.0/umd/react.production.min.js" ></script>
<!--支持react操作dom-->
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/react-dom/18.2.0/umd/react-dom.production.min.js"></script>
<!--引入babel,用于将jsx转化为js-->
<script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/babel-standalone/6.26.0/babel.min.js" ></script>
</head>
<body>

<div id="test1"></div>
<div id="test2"></div>
<div id="test3"></div>


<script type="text/babel"> 

    class Person extends React.Component{
        render(){
            const {name, age, sex} = this.props;
            return(
                <ul>
                    <li>姓名:{name}</li>
                    <li>年龄:{age}</li>
                    <li>性别:{sex}</li>
                </ul>
            )
        }
    }
    ReactDOM.render(<Person name = "Jerry" age = "19" sex = 'Male' />,document.getElementById('test1'))
    ReactDOM.render(<Person name = "Cherry" age = "19" sex = 'Female' />,document.getElementById('test2'))
    
    //在react中babel+react可以在标签中展开对象
    const p = {name : "Jack",age:18,sex:'Female'}
    ReactDOM.render(<Person {...p} />,document.getElementById('test3'))

</script>

</body>
</html>